// Copyright (c) Appeon. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

namespace SnapObjects.Data
{
    /// <summary>
    ///     Represents an object used to build a SQL UPDATE statement.
    ///     The SQL UPDATE statement can be used to change the existing data in a table or view.
    /// </summary>
    public interface ISqlUpdateBuilder : ISqlFromBuilder, ISqlBuilder
    {
        /// <summary>
        ///     Creates a SQL UPDATE statement and specifies the name of the table or view from which the rows are to be updated.
        /// </summary>
        /// <param name="table">The name of the table or view from which the rows are to be updated.</param>
        /// <returns>Returns the current ISqlUpdateBuilder object.</returns>
        ISqlUpdateBuilder Update(string table);

        /// <summary>
        ///     Creates a SQL UPDATE statement and specifies the name and schema of the table or view from
        ///     which the rows are to be updated.
        /// </summary>
        /// <param name="table">The name of the table or view from which the rows are to be updated.</param>
        /// <param name="schema">The name of the schema to which the table or view belongs.</param>
        /// <returns>Returns the current ISqlUpdateBuilder object.</returns>
        ISqlUpdateBuilder Update(string table, string schema);

        /// <summary>
        ///     Specifies a column to be updated with a new value.
        /// </summary>
        /// <param name="columnName">The name of the column to be updated.</param>
        /// <param name="value">The value to be updated to the column.</param>
        /// <returns>Returns the current ISqlUpdateBuilder object.</returns>
        ISqlUpdateBuilder SetValue(string columnName, object value);

        /// <summary>
        ///     Specifies the value of a column to be updated with a SQL parameter.
        /// </summary>
        /// <param name="columnName">The name of the column to be updated.</param>
        /// <param name="parameter">
        ///     An ISqlParameter object which represents a SQL parameter.
        ///     It can be created by calling the SqlBuilder.Parameter method.
        /// </param>
        /// <returns>Returns the current ISqlUpdateBuilder object.</returns>
        ISqlUpdateBuilder Set(string columnName, ISqlParameter parameter);

        /// <summary>
        ///     Specifies the value of a column to be updated with a raw SQL.
        /// </summary>
        /// <param name="columnName">The name of the column to be updated.</param>
        /// <param name="clause">A string of raw SQL which is to be updated to the column.</param>
        /// <returns>Returns the current ISqlUpdateBuilder object.</returns>
        ISqlUpdateBuilder Set(string columnName, string clause);

        /// <summary>
        ///     Specifies the value of a column to be updated with a SQL subquery (specified by an ISqlBuilder object).
        /// </summary>
        /// <param name="columnName">The name of the column to be updated.</param>
        /// <param name="queryBuilder">An ISqlBuilder object which represents a SQL subquery.</param>
        /// <returns>Returns the current ISqlUpdateBuilder object.</returns>
        ISqlUpdateBuilder Set(string columnName, ISqlBuilder queryBuilder);

        /// <summary>
        ///     Specifies one or more columns whose data will be changed by a raw SQL.
        /// </summary>
        /// <param name="setRaw">
        ///     A string of raw SQL which specifies one or more columns whose data will be changed.
        /// </param>
        /// <returns>Returns the current ISqlUpdateBuilder object.</returns>
        ISqlUpdateBuilder SetRaw(string setRaw);
    }
}
